
const int hall_a = 8, hall_b = 10, hall_c = 11;
const int hall_pins[] = {hall_a, hall_b, hall_c}; 
int count = 0;
int a1,a2, b1,b2, c1,c2;

void setup() {
  Serial.begin(57600);
  Serial.print("A1"); Serial.println(A1);
  Serial.print("A2"); Serial.println(A2);
  Serial.print("INPUT_PULLUP"); Serial.println(INPUT_PULLUP);

  for (int i=0; i<3; i++){
    pinMode(hall_pins[i], INPUT_PULLUP);
    Serial.print(i); Serial.print(" hall "); Serial.println(hall_pins[i]);
  }
}


void loop() {
//  Serial.print(digitalRead(hall_a)); Serial.print(",");
//  Serial.print(digitalRead(hall_b)*2); Serial.print(",");
//  Serial.print(digitalRead(hall_c)*3); Serial.println();
//  delay(20);

  a1 = digitalRead(hall_a);
  b1 = digitalRead(hall_b);
  c1 = digitalRead(hall_c);
  if (a1 != a2 || b1 != b2 || c1 != c2) {
    count ++;
    a2 = a1; b2 = b1; c2 = c1;
  }
  Serial.println(count);
}
